/**
 * Created by myd on 15/10/21.
 */

Ext.define('MyApp.model.StaffModel', {
    extend: 'Ext.data.Model',
    requires: [
        'Ext.data.reader.Json'
    ],

    fields: [
        {name: 'staff_pk', type: 'string'},
        {name: 'staff_loginname', type: 'string'},
        {name: 'staff_name', type: 'string'},
        {name: 'staff_password', type: 'string'},
        {name: 'fk_roles_pk', type: 'string'},
        //{name: 'staff_sex', type: 'string'},
        {name: 'staff_birthday', type: 'string'},
        {name: 'staff_phone', type: 'string'},
        {name: 'staff_email', type: 'string'},
        {name: 'staff_intime', type: 'string'},
        {
            name:'displaySex',
            convert:function(value, record){
                var v = record.data.staff_sex;
                if(null == v)
                    return '<span class="red">未知</span>';
                else if(1 == v)
                    return '<span class="blue">男</span>';
                else
                    return '<span class="red">女</span>';
            },
            mapping:'displaySex'
        },'staff_sex',
        {
            name:'displayStatus',
            convert:function(value, record){
                var v = record.data.staff_status;
                if(null == v)
                    return '<span class="red">未知</span>';
                else if(1 == v)
                    return '<span class="blue">启用</span>';
                else
                    return '<span class="red">禁用</span>';
            },
            mapping:'displayStatus'
        },'staff_status'

    ]


});